<?php
/**
 * ContentTargetingPredicate
 *
 * PHP version 5
 *
 * @category Class
 * @package  AmazonAdvertisingApi
 * @author   vv_guo
 * @link    https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api
 */

/**
 * Amazon Ads API for Sponsored Display
 *
 * This API enables programmatic access for campaign creation, management, and reporting for Sponsored Display campaigns. For more information on the functionality, see the [Sponsored Display Support Center](https://advertising.amazon.com/help#GTPPHE6RAWC2C4LZ). For API onboarding information, see the [account setup](https://advertising.amazon.com/API/docs/en-us/guides/onboarding/overview) topic.<br/><br/> > This specification is available for download from the **[Advertising API developer portal](https://d3a0d0y2hgofx6.cloudfront.net/openapi/en-us/sponsored-display/3-0/openapi.yaml).**
 *
 * OpenAPI spec version: 3.0
 * 
 * Generated by:https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api.git
 * AmazonAdvertisingApi Codegen version: 3.0.51
 */
/**
 * NOTE: This class is auto generated by the AmazonAdvertisingApi code generator program.
 *https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api
 * Do not edit the class manually.
 */

namespace AmazonAdvertisingApi\Model;

use \ArrayAccess;
use \AmazonAdvertisingApi\ObjectSerializer;

/**
 * ContentTargetingPredicate Class Doc Comment
 *
 * @category Class
 * @description A predicate to match against in the content targeting expression.
 * @package  AmazonAdvertisingApi
 * @author   vv_guo
 * @link    https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api
 */
class ContentTargetingPredicate implements ModelInterface, ArrayAccess
{
    const DISCRIMINATOR = null;

    /**
      * The original name of the model.
      *
      * @var string
      */
    protected static $AmazonAdvertisingApiModelName = 'ContentTargetingPredicate';

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $AmazonAdvertisingApiTypes = [
        'type' => 'string',
        'value' => 'string'
    ];

    /**
      * Array of property to format mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $AmazonAdvertisingApiFormats = [
        'type' => null,
        'value' => null
    ];

    /**
     * Array of property to type mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function AmazonAdvertisingApiTypes()
    {
        return self::$AmazonAdvertisingApiTypes;
    }

    /**
     * Array of property to format mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function AmazonAdvertisingApiFormats()
    {
        return self::$AmazonAdvertisingApiFormats;
    }

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @var string[]
     */
    protected static $attributeMap = [
        'type' => 'type',
        'value' => 'value'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'type' => 'setType',
        'value' => 'setValue'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'type' => 'getType',
        'value' => 'getValue'
    ];

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @return array
     */
    public static function attributeMap()
    {
        return self::$attributeMap;
    }

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @return array
     */
    public static function setters()
    {
        return self::$setters;
    }

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @return array
     */
    public static function getters()
    {
        return self::$getters;
    }

    /**
     * The original name of the model.
     *
     * @return string
     */
    public function getModelName()
    {
        return self::$AmazonAdvertisingApiModelName;
    }

    const TYPE_CONTENT_CATEGORY_SAME_AS = 'contentCategorySameAs';

    /**
     * Gets allowable values of the enum
     *
     * @return string[]
     */
    public function getTypeAllowableValues()
    {
        return [
            self::TYPE_CONTENT_CATEGORY_SAME_AS,
        ];
    }

    /**
     * Associative array for storing property values
     *
     * @var mixed[]
     */
    protected $container = [];

    /**
     * Constructor
     *
     * @param mixed[] $data Associated array of property values
     *                      initializing the model
     */
    public function __construct(array $data = null)
    {
        $this->container['type'] = isset($data['type']) ? $data['type'] : null;
        $this->container['value'] = isset($data['value']) ? $data['value'] : null;
    }

    /**
     * Show all the invalid properties with reasons.
     *
     * @return array invalid properties with reasons
     */
    public function listInvalidProperties()
    {
        $invalidProperties = [];

        $allowedValues = $this->getTypeAllowableValues();
        if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) {
            $invalidProperties[] = sprintf(
                "invalid value for 'type', must be one of '%s'",
                implode("', '", $allowedValues)
            );
        }

        return $invalidProperties;
    }

    /**
     * Validate all the properties in the model
     * return true if all passed
     *
     * @return bool True if all properties are valid
     */
    public function valid()
    {
        return count($this->listInvalidProperties()) === 0;
    }


    /**
     * Gets type
     *
     * @return string
     */
    public function getType()
    {
        return $this->container['type'];
    }

    /**
     * Sets type
     *
     * @param string $type type
     *
     * @return $this
     */
    public function setType($type)
    {
        $allowedValues = $this->getTypeAllowableValues();
        if (!is_null($type) && !in_array($type, $allowedValues, true)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value for 'type', must be one of '%s'",
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['type'] = $type;

        return $this;
    }

    /**
     * Gets value
     *
     * @return string
     */
    public function getValue()
    {
        return $this->container['value'];
    }

    /**
     * Sets value
     *
     * @param string $value The value to be targeted.  The following table shows all possible values of the `contentCategorySameAs` predicate. | Category              | Subcategory                             | Value                    | |-----------------------|-----------------------------------------|--------------------------| | Movies and Television | All Movies and Television               | amzn1.iab-content.SPSHQ5 | | Movies and Television | Action or Adventure                     | amzn1.iab-content.325    | | Movies and Television | Animation or Anime                      | amzn1.iab-content.641    | | Movies and Television | Biographies                             | amzn1.iab-content.44     | | Movies and Television | Comedy                                  | amzn1.iab-content.646    | | Movies and Television | Documentary                             | amzn1.iab-content.332    | | Movies and Television | Drama                                   | amzn1.iab-content.647    | | Movies and Television | Factual                                 | amzn1.iab-content.648    | | Movies and Television | Family                                  | amzn1.iab-content.645    | | Movies and Television | Fantasy                                 | amzn1.iab-content.335    | | Movies and Television | History                                 | amzn1.iab-content.EZWB7V | | Movies and Television | Holiday                                 | amzn1.iab-content.649    | | Movies and Television | Horror                                  | amzn1.iab-content.336    | | Movies and Television | Lifestyle                               | amzn1.iab-content.TIFQA5 | | Movies and Television | Music Video                             | amzn1.iab-content.650    | | Movies and Television | Musicals                                | amzn1.iab-content.156    | | Movies and Television | Mystery                                 | amzn1.iab-content.331    | | Movies and Television | Reality TV                              | amzn1.iab-content.651    | | Movies and Television | Romance                                 | amzn1.iab-content.326    | | Movies and Television | Science Fiction                         | amzn1.iab-content.652    | | Movies and Television | Soap Opera                              | amzn1.iab-content.642    | | Movies and Television | Special Interest (Indie or Art House)   | amzn1.iab-content.643    | | Movies and Television | Sports Radio                            | amzn1.iab-content.370    | | Movies and Television | Talk Show                               | amzn1.iab-content.A0AH3G | | Movies and Television | True Crime                              | amzn1.iab-content.KHPC5A | | Movies and Television | Western                                 | amzn1.iab-content.KHPC6A | | Music and Radio       | All Music and Radio                     | amzn1.iab-content.338    | | Music and Radio       | Blues                                   | amzn1.iab-content.360    | | Music and Radio       | Classical Music                         | amzn1.iab-content.346    | | Music and Radio       | Comedy (Music and Audio)                | amzn1.iab-content.348    | | Music and Radio       | Pop, Contemporary Hits, or Top 40 Music | amzn1.iab-content.349    | | Music and Radio       | Country Music                           | amzn1.iab-content.350    | | Music and Radio       | Dance and Electronic Music              | amzn1.iab-content.351    | | Music and Radio       | Hip Hop Music                           | amzn1.iab-content.355    | | Music and Radio       | Inspirational or New Age Music          | amzn1.iab-content.356    | | Music and Radio       | Jazz                                    | amzn1.iab-content.357    | | Music and Radio       | Oldies or Adult Standards               | amzn1.iab-content.358    | | Music and Radio       | R&B, Soul or Funk Music                 | amzn1.iab-content.362    | | Music and Radio       | Reggae                                  | amzn1.iab-content.359    | | Music and Radio       | Rock Music                              | amzn1.iab-content.363    | | Music and Radio       | Songwriters or Folk                     | amzn1.iab-content.353    | | Music and Radio       | World or International Music            | amzn1.iab-content.352    | | Video Games           | All Video Games                         | amzn1.iab-content.680    | | Video Games           | Action-Adventure Games                  | amzn1.iab-content.691    | | Video Games           | Casual Games                            | amzn1.iab-content.693    | | Video Games           | Puzzle Video Games                      | amzn1.iab-content.698    | | Video Games           | Racing Video Games                      | amzn1.iab-content.VK7KD0 | | Video Games           | Role-Playing Video Games                | amzn1.iab-content.687    | | Video Games           | Simulation Video Games                  | amzn1.iab-content.688    | | Video Games           | Sports Video Games                      | amzn1.iab-content.689    | | Video Games           | Strategy Video Games                    | amzn1.iab-content.690    | | Video Games           | PC Games                                | amzn1.iab-content.684    | | Video Games           | Mobile Games                            | amzn1.iab-content.683    | | Video Games           | Console Games                           | amzn1.iab-content.681    | | Video Games           | eSports                                 | amzn1.iab-content.682    |
     *
     * @return $this
     */
    public function setValue($value)
    {
        $this->container['value'] = $value;

        return $this;
    }
    /**
     * Returns true if offset exists. False otherwise.
     *
     * @param integer $offset Offset
     *
     * @return boolean
     */
    #[\ReturnTypeWillChange]
    public function offsetExists($offset)
    {
        return isset($this->container[$offset]);
    }

    /**
     * Gets offset.
     *
     * @param integer $offset Offset
     *
     * @return mixed
     */
    #[\ReturnTypeWillChange]
    public function offsetGet($offset)
    {
        return isset($this->container[$offset]) ? $this->container[$offset] : null;
    }

    /**
     * Sets value based on offset.
     *
     * @param integer $offset Offset
     * @param mixed   $value  Value to be set
     *
     * @return void
     */
    #[\ReturnTypeWillChange]
    public function offsetSet($offset, $value)
    {
        if (is_null($offset)) {
            $this->container[] = $value;
        } else {
            $this->container[$offset] = $value;
        }
    }

    /**
     * Unsets offset.
     *
     * @param integer $offset Offset
     *
     * @return void
     */
    #[\ReturnTypeWillChange]
    public function offsetUnset($offset)
    {
        unset($this->container[$offset]);
    }

    /**
     * Gets the string presentation of the object
     *
     * @return string
     */
    public function __toString()
    {
        if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
            return json_encode(
                ObjectSerializer::sanitizeForSerialization($this),
                JSON_PRETTY_PRINT
            );
        }

        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
    }
}
